import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';

// 查询列表
export class FindStudentDto {
  @ApiProperty({ default: 1, description: '当前页' })
  @Type(() => Number)
  @IsNumber()
  page: number = 1;

  @ApiProperty({ default: 10, description: '查询条数' })
  @Type(() => Number)
  @IsNumber()
  size: number = 10;

  @ApiPropertyOptional({ description: '学生姓名' })
  @IsOptional()
  @IsString()
  name?: string;

  @ApiPropertyOptional({ description: '学号' })
  @IsOptional()
  @IsString()
  studentNumber?: string;
}

// 更新学生信息
export class UpdateStudentDto {
  @ApiProperty({ description: '学生ID' })
  @IsNotEmpty()
  @IsNumber()
  id: number;

  @ApiProperty({ description: '姓名' })
  @IsNotEmpty()
  @IsString()
  name: string;

  @ApiProperty({ description: '性别' })
  @IsNotEmpty()
  @IsString()
  sex: string;

  @ApiProperty({ description: '出生年月' })
  @IsNotEmpty()
  @IsString()
  birth: string;

  @ApiProperty({ description: '学院' })
  @IsNotEmpty()
  @IsString()
  college: string;

  @ApiProperty({ description: '专业' })
  @IsNotEmpty()
  @IsString()
  major: string;

  @ApiProperty({ description: '在校经历' })
  @IsOptional()
  @IsString()
  experience?: string;

  @ApiProperty({ description: '专业技能' })
  @IsOptional()
  @IsString()
  skill?: string;
}
